--[[ **********************************************************************************************

 Mod Name: Max Stacks
 Version: 0.4.0
 Release Date: March 28, 2013
 Forum Thread: http://bit.ly/Z33I9X

 Created by: LoudAssCrow

 Features:
	Stack all Stackable Items to 99.
	Make non-stackable items stackable

 Compatibility:
 	Doorway to Adventure
 
 Known Issues:
	Items with Durability (Weapons, Tools, Armor, etc) cannot be stacked
	User-made (custom) Items are not supported
	Modded Non-stackable items when dropped will be treated like 1 item
		(example: dropping a stack of rabbits and killing them will only yield 1 morsel)

 Disclaimer:
	Many Items have not been tested, back-up your save files before using
	If you encounter a problem, or I missed an item, please notify me via the Klei Forums


*********************************************************************************************** ]]


-- Define functions

function stackPrefabPostInit(inst)

	inst.components.stackable.maxsize = 99

end

function makestackablePrefabPostInit(inst)

	inst:AddComponent("stackable")
		inst.components.stackable.maxsize = 99

end



-- Resources

AddPrefabPostInit("boards", stackPrefabPostInit)
AddPrefabPostInit("charcoal", stackPrefabPostInit)
AddPrefabPostInit("cutgrass", stackPrefabPostInit)
AddPrefabPostInit("cutreeds", stackPrefabPostInit)
AddPrefabPostInit("cutstone", stackPrefabPostInit)
AddPrefabPostInit("dug_berrybush", stackPrefabPostInit)
AddPrefabPostInit("dug_berrybush2", stackPrefabPostInit)
AddPrefabPostInit("dug_grass", stackPrefabPostInit)
AddPrefabPostInit("dug_sapling", stackPrefabPostInit)
AddPrefabPostInit("flint", stackPrefabPostInit)
AddPrefabPostInit("goldnugget", stackPrefabPostInit)
AddPrefabPostInit("gunpowder", stackPrefabPostInit)
AddPrefabPostInit("log", stackPrefabPostInit)
AddPrefabPostInit("marble", stackPrefabPostInit)
AddPrefabPostInit("nitre", stackPrefabPostInit)
AddPrefabPostInit("papyrus", stackPrefabPostInit)
AddPrefabPostInit("petals", stackPrefabPostInit)
AddPrefabPostInit("petals_evil", stackPrefabPostInit)
AddPrefabPostInit("pinecone", stackPrefabPostInit)
AddPrefabPostInit("poop", stackPrefabPostInit)
AddPrefabPostInit("rocks", stackPrefabPostInit)
AddPrefabPostInit("rope", stackPrefabPostInit)
AddPrefabPostInit("silk", stackPrefabPostInit)
AddPrefabPostInit("spidereggsack", stackPrefabPostInit)
AddPrefabPostInit("turf_carpetfloor", stackPrefabPostInit)
AddPrefabPostInit("turf_checkerfloor", stackPrefabPostInit)
AddPrefabPostInit("turf_dirt", stackPrefabPostInit)
AddPrefabPostInit("turf_forest", stackPrefabPostInit)
AddPrefabPostInit("turf_grass", stackPrefabPostInit)
AddPrefabPostInit("turf_marsh", stackPrefabPostInit)
AddPrefabPostInit("turf_rocky", stackPrefabPostInit)
AddPrefabPostInit("turf_road", stackPrefabPostInit)
AddPrefabPostInit("turf_savanna", stackPrefabPostInit)
AddPrefabPostInit("turf_webbing", stackPrefabPostInit)
AddPrefabPostInit("turf_woodfloor", stackPrefabPostInit)
AddPrefabPostInit("twigs", stackPrefabPostInit)
AddPrefabPostInit("wall_hay_item", stackPrefabPostInit)
AddPrefabPostInit("wall_stone_item", stackPrefabPostInit)
AddPrefabPostInit("wall_wood_item", stackPrefabPostInit)


-- Edible Resources

AddPrefabPostInit("berries", stackPrefabPostInit)
AddPrefabPostInit("berries_cooked", stackPrefabPostInit)
AddPrefabPostInit("berries_seeds", stackPrefabPostInit)
AddPrefabPostInit("blue_cap", stackPrefabPostInit)
AddPrefabPostInit("butter", stackPrefabPostInit)
AddPrefabPostInit("carrot", stackPrefabPostInit)
AddPrefabPostInit("carrot_cooked", stackPrefabPostInit)
AddPrefabPostInit("carrot_seeds", stackPrefabPostInit)
AddPrefabPostInit("cookedmeat", stackPrefabPostInit)
AddPrefabPostInit("cookedsmallmeat", stackPrefabPostInit)
AddPrefabPostInit("cookedmonstermeat", stackPrefabPostInit)
AddPrefabPostInit("corn", stackPrefabPostInit)
AddPrefabPostInit("corn_cooked", stackPrefabPostInit)
AddPrefabPostInit("corn_seeds", stackPrefabPostInit)
AddPrefabPostInit("dragonfruit", stackPrefabPostInit)
AddPrefabPostInit("dragonfruit_cooked", stackPrefabPostInit)
AddPrefabPostInit("dragonfruit_seeds", stackPrefabPostInit)
AddPrefabPostInit("dried_meat", stackPrefabPostInit)
AddPrefabPostInit("drumstick", stackPrefabPostInit)
AddPrefabPostInit("drumstick_cooked", stackPrefabPostInit)
AddPrefabPostInit("durian", stackPrefabPostInit)
AddPrefabPostInit("durian_cooked", stackPrefabPostInit)
AddPrefabPostInit("durian_seeds", stackPrefabPostInit)
AddPrefabPostInit("eggplant", stackPrefabPostInit)
AddPrefabPostInit("eggplant_cooked", stackPrefabPostInit)
AddPrefabPostInit("eggplant_seeds", stackPrefabPostInit)
AddPrefabPostInit("fish", stackPrefabPostInit)
AddPrefabPostInit("fish_cooked", stackPrefabPostInit)
AddPrefabPostInit("froglegs", stackPrefabPostInit)
AddPrefabPostInit("froglegs_cooked", stackPrefabPostInit)
AddPrefabPostInit("green_cap", stackPrefabPostInit)
AddPrefabPostInit("honey", stackPrefabPostInit)
AddPrefabPostInit("mandrake", stackPrefabPostInit)
AddPrefabPostInit("mandrake_cooked", stackPrefabPostInit)
AddPrefabPostInit("meat", stackPrefabPostInit)
AddPrefabPostInit("meat_dried", stackPrefabPostInit)
AddPrefabPostInit("monstermeat", stackPrefabPostInit)
AddPrefabPostInit("monstermeat_dried", stackPrefabPostInit)
AddPrefabPostInit("pomegranate", stackPrefabPostInit)
AddPrefabPostInit("pomegranate_cooked", stackPrefabPostInit)
AddPrefabPostInit("pomegranate_seeds", stackPrefabPostInit)
AddPrefabPostInit("pumpkin", stackPrefabPostInit)
AddPrefabPostInit("pumpkin_cooked", stackPrefabPostInit)
AddPrefabPostInit("pumpkin_seeds", stackPrefabPostInit)
AddPrefabPostInit("pumpkin", stackPrefabPostInit)
AddPrefabPostInit("red_cap", stackPrefabPostInit)
AddPrefabPostInit("smallmeat", stackPrefabPostInit)
AddPrefabPostInit("smallmeat_dried", stackPrefabPostInit)
AddPrefabPostInit("tallbirdegg", makestackablePrefabPostInit)
AddPrefabPostInit("tallbirdegg_cooked", stackPrefabPostInit)
AddPrefabPostInit("tallbirdegg_cracked", makestackablePrefabPostInit)
AddPrefabPostInit("trunk_cooked", stackPrefabPostInit)
AddPrefabPostInit("trunk_summer", stackPrefabPostInit)
AddPrefabPostInit("trunk_winter", stackPrefabPostInit)

-- Healing Resources

AddPrefabPostInit("bandage", stackPrefabPostInit)
AddPrefabPostInit("healingsalve", stackPrefabPostInit)

-- Crock-Pot Foods

AddPrefabPostInit("baconeggs", stackPrefabPostInit)
AddPrefabPostInit("bonestew", stackPrefabPostInit)
AddPrefabPostInit("butterflymuffin", stackPrefabPostInit)
AddPrefabPostInit("fishsticks", stackPrefabPostInit)
AddPrefabPostInit("fishtacos", stackPrefabPostInit)
AddPrefabPostInit("frogglebunwich", stackPrefabPostInit)
AddPrefabPostInit("fruitmedley", stackPrefabPostInit)
AddPrefabPostInit("honeyham", stackPrefabPostInit)
AddPrefabPostInit("honeynuggets", stackPrefabPostInit)
AddPrefabPostInit("jammypreserves", stackPrefabPostInit)
AddPrefabPostInit("kabobs", stackPrefabPostInit)
AddPrefabPostInit("mandrakesoup", stackPrefabPostInit)
AddPrefabPostInit("meatballs", stackPrefabPostInit)
AddPrefabPostInit("monsterlasagna", stackPrefabPostInit)
AddPrefabPostInit("perogies", stackPrefabPostInit)
AddPrefabPostInit("pumpkincookie", stackPrefabPostInit)
AddPrefabPostInit("ratatouille", stackPrefabPostInit)
AddPrefabPostInit("stuffedeggplant", stackPrefabPostInit)
AddPrefabPostInit("taffy", stackPrefabPostInit)
AddPrefabPostInit("turkeydinner", stackPrefabPostInit)
AddPrefabPostInit("waffles", stackPrefabPostInit)
AddPrefabPostInit("wetgoop", stackPrefabPostInit)


-- Clothing

AddPrefabPostInit("beefalohat", makestackablePrefabPostInit)
AddPrefabPostInit("bushhat", makestackablePrefabPostInit)
AddPrefabPostInit("earmuffshat", makestackablePrefabPostInit)
AddPrefabPostInit("featherhat", makestackablePrefabPostInit)
AddPrefabPostInit("strawhat", makestackablePrefabPostInit)
AddPrefabPostInit("sweatervest", makestackablePrefabPostInit)
AddPrefabPostInit("trunkvest_summer", makestackablePrefabPostInit)
AddPrefabPostInit("trunkvest_winter", makestackablePrefabPostInit)
AddPrefabPostInit("tophat", makestackablePrefabPostInit)
AddPrefabPostInit("walrushat", makestackablePrefabPostInit)
AddPrefabPostInit("winterhat", makestackablePrefabPostInit)


-- Loot

AddPrefabPostInit("beefalowool", stackPrefabPostInit)
AddPrefabPostInit("bluegem", stackPrefabPostInit)
AddPrefabPostInit("butterflywings", stackPrefabPostInit)
AddPrefabPostInit("deerclops_eyeball", makestackablePrefabPostInit)
AddPrefabPostInit("feather_crow", stackPrefabPostInit)
AddPrefabPostInit("feather_robin", stackPrefabPostInit)
AddPrefabPostInit("feather_robin_winter", stackPrefabPostInit)
AddPrefabPostInit("gears", stackPrefabPostInit)
AddPrefabPostInit("honeycomb", stackPrefabPostInit)
AddPrefabPostInit("houndstooth", stackPrefabPostInit)
AddPrefabPostInit("nightmarefuel", stackPrefabPostInit)
AddPrefabPostInit("pigskin", stackPrefabPostInit)
AddPrefabPostInit("purplegem", stackPrefabPostInit)
AddPrefabPostInit("redgem", stackPrefabPostInit)
AddPrefabPostInit("spidergland", stackPrefabPostInit)
AddPrefabPostInit("stinger", stackPrefabPostInit)
AddPrefabPostInit("tentaclespots", stackPrefabPostInit)
AddPrefabPostInit("walrus_tusk", stackPrefabPostInit)


-- Animals

AddPrefabPostInit("bee", stackPrefabPostInit)
AddPrefabPostInit("butterfly", stackPrefabPostInit)
AddPrefabPostInit("crow", makestackablePrefabPostInit)
AddPrefabPostInit("dragonpie", stackPrefabPostInit)
AddPrefabPostInit("fireflies", stackPrefabPostInit)
AddPrefabPostInit("mosquito", stackPrefabPostInit)
AddPrefabPostInit("rabbit", makestackablePrefabPostInit)
AddPrefabPostInit("robin", makestackablePrefabPostInit)
AddPrefabPostInit("robin_winter", makestackablePrefabPostInit)


-- Weapons

AddPrefabPostInit("beemine", makestackablePrefabPostInit)
AddPrefabPostInit("blowdart_fire", stackPrefabPostInit)
AddPrefabPostInit("blowdart_pipe", stackPrefabPostInit)
AddPrefabPostInit("blowdart_sleep", stackPrefabPostInit)


-- Teleportato Items

AddPrefabPostInit("teleportato_box", makestackablePrefabPostInit)
AddPrefabPostInit("teleportato_crank", makestackablePrefabPostInit)
AddPrefabPostInit("teleportato_potato", makestackablePrefabPostInit)
AddPrefabPostInit("teleportato_ring", makestackablePrefabPostInit)


-- Grave Items

AddPrefabPostInit("amulet", stackPrefabPostInit)
AddPrefabPostInit("trinket_1", stackPrefabPostInit)
AddPrefabPostInit("trinket_2", stackPrefabPostInit)
AddPrefabPostInit("trinket_3", stackPrefabPostInit)
AddPrefabPostInit("trinket_4", stackPrefabPostInit)
AddPrefabPostInit("trinket_5", stackPrefabPostInit)
AddPrefabPostInit("trinket_6", stackPrefabPostInit)
AddPrefabPostInit("trinket_7", stackPrefabPostInit)
AddPrefabPostInit("trinket_8", stackPrefabPostInit)
AddPrefabPostInit("trinket_9", stackPrefabPostInit)
AddPrefabPostInit("trinket_10", stackPrefabPostInit)
AddPrefabPostInit("trinket_11", stackPrefabPostInit)
AddPrefabPostInit("trinket_12", stackPrefabPostInit)


-- Misc

AddPrefabPostInit("ash", stackPrefabPostInit)
AddPrefabPostInit("beardhair", stackPrefabPostInit)
AddPrefabPostInit("bedroll_straw", stackPrefabPostInit)
AddPrefabPostInit("chester_eyebone", makestackablePrefabPostInit)
AddPrefabPostInit("heatrock", makestackablePrefabPostInit)
AddPrefabPostInit("razor", makestackablePrefabPostInit)
AddPrefabPostInit("spoiledfood", stackPrefabPostInit)


-- Unimplemented items

--AddPrefabPostInit("phonograph_box", makestackablePrefabPostInit)
--AddPrefabPostInit("phonograph_cone", makestackablePrefabPostInit)
--AddPrefabPostInit("phonograph_crank", makestackablePrefabPostInit)
--AddPrefabPostInit("phonograph_gears", makestackablePrefabPostInit)
